package com.xyz.rok.tools.utils;

import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;

import java.io.File;

/**
 * @author ZhangYiXin
 * @version 1.0
 * @date 2021/2/24 11:17
 **/
public class Test {
    public static void main(String[] args) {
        System.out.println("---------------------start--------------------------");
        Tesseract tesseract = new Tesseract();
        tesseract.setTessVariable("user_defined_dpi", "300");
        tesseract.setDatapath("D:\\IdeaProjects\\tess4j\\src\\main\\resources");
        tesseract.setLanguage("chi_sim");
        try {
            System.out.println(tesseract.doOCR(new File("C:\\Users\\Administrator\\Pictures\\2.png")));
        } catch (TesseractException e) {
            e.printStackTrace();
        }

        System.out.println("----------------------end---------------------------");
    }
}
